package com.ccsu.joysport.entity;


import jakarta.persistence.*;

import java.sql.Date;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.UUID;

@Entity
public class Activity {

    @Id
    private String activityId;

    private String activityName;
    private String activityDesc;
    private String activityImage;
    private Timestamp activityTimeStart;
    private Timestamp activityTimeEnd;
    private int activityMax;
    private String activityOrganizer;
    private String clubId;
    private String activityPerson;
    private String activityPlace;

    @PrePersist
    private void ensureId() {
        if (this.activityId == null) {
            this.activityId = UUID.randomUUID().toString();
        }
        if (this.gmtCreate == null) {
            this.gmtCreate = new Date(System.currentTimeMillis());
        }
        if (this.gmtModified == null) {
            this.gmtModified = new Date(System.currentTimeMillis());
        }
    }

    // 审核状态  approve通过 reject拒绝 wait待审核
    private String activityStatus;
    // 审核备注
    private String reviewRemark;
    // 创建时间
    private Date gmtCreate;
    // 修改时间
    private Date gmtModified;
    // 创建者学号
    private String createUser;

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public String getActivityStatus() {
        return activityStatus;
    }

    public void setActivityStatus(String activityStatus) {
        this.activityStatus = activityStatus;
    }

    public String getReviewRemark() {
        return reviewRemark;
    }

    public void setReviewRemark(String reviewRemark) {
        this.reviewRemark = reviewRemark;
    }

    public Date getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Date gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public Date getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(Date gmtModified) {
        this.gmtModified = gmtModified;
    }

    // Getters and setters


    public String getActivityId() {
        return activityId;
    }

    public void setActivityId(String activityId) {
        this.activityId = activityId;
    }

    public String getActivityName() {
        return activityName;
    }

    public void setActivityName(String activityName) {
        this.activityName = activityName;
    }

    public String getActivityDesc() {
        return activityDesc;
    }

    public void setActivityDesc(String activityDesc) {
        this.activityDesc = activityDesc;
    }

    public String getActivityImage() {
        return activityImage;
    }

    public void setActivityImage(String activityImage) {
        this.activityImage = activityImage;
    }

    public Timestamp getActivityTimeStart() {
        return activityTimeStart;
    }

    public void setActivityTimeStart(Timestamp activityTimeStart) {
        this.activityTimeStart = activityTimeStart;
    }

    public Timestamp getActivityTimeEnd() {
        return activityTimeEnd;
    }

    public void setActivityTimeEnd(Timestamp activityTimeEnd) {
        this.activityTimeEnd = activityTimeEnd;
    }

    public int getActivityMax() {
        return activityMax;
    }

    public void setActivityMax(int activityMax) {
        this.activityMax = activityMax;
    }

    public String getActivityOrganizer() {
        return activityOrganizer;
    }

    public void setActivityOrganizer(String activityOrganizer) {
        this.activityOrganizer = activityOrganizer;
    }

    public String getClubId() {
        return clubId;
    }

    public void setClubId(String clubId) {
        this.clubId = clubId;
    }

    public String getActivityPerson() {
        return activityPerson;
    }

    public void setActivityPerson(String activityPerson) {
        this.activityPerson = activityPerson;
    }

    public String getActivityPlace() {
        return activityPlace;
    }

    public void setActivityPlace(String activityPlace) {
        this.activityPlace = activityPlace;
    }

    public String getFormattedActivityTimeStart() {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return dateFormat.format(activityTimeStart);
    }

    public String getFormattedActivityTimeEnd() {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return dateFormat.format(activityTimeEnd);
    }



}
